import request from '@/config/axios'

// 搜索历史信息 VO
export interface HistoryVO {
  id: number // 搜索历史编号，自增
  userid: number // 该搜索记录所属用户
  name: string // 历史搜索信息
  sort: number // 排序字段
}

// 搜索历史信息 API
export const HistoryApi = {

  // 获得 近期搜索历史
  searchLastestHistory :async () => {
    return await request.get({ url: '/search/history/lastest' })
  },
  // 查询搜索历史信息分页
  getHistoryPage: async (params: any) => {
    return await request.get({ url: `/search/history/page`, params })
  },

  // 查询搜索历史信息详情
  getHistory: async (id: number) => {
    return await request.get({ url: `/search/history/get?id=` + id })
  },

  // 新增搜索历史信息
  createHistory: async (data: HistoryVO) => {
    return await request.post({ url: `/search/history/create`, data })
  },

  // 修改搜索历史信息
  updateHistory: async (data: HistoryVO) => {
    return await request.put({ url: `/search/history/update`, data })
  },

  // 删除搜索历史信息
  deleteHistory: async (id: number) => {
    return await request.delete({ url: `/search/history/delete?id=` + id })
  },

  // 导出搜索历史信息 Excel
  exportHistory: async (params) => {
    return await request.download({ url: `/search/history/export-excel`, params })
  },
}
